<template>
  <div id="tmpl">
    <div class="title">
      <h4>{{list.title}}</h4>
      <p>{{list.add_time}} {{list.click}}次浏览</p>
    </div>
    <div id="content" v-html="list.content">
      
    </div>

    <!-- 添加组件 -->
    <comment :id="id"></comment>
  </div>
</template>

<script>
  import { Toast } from 'mint-ui';
  import common from '../../kits/common.js';
  import comment from '../subcom/comment.vue';
  export default {
    data() {
      return {
        id: 0,
        list: []
      }
    },
    components: {
      comment
    },
    created() {
      this.id = this.$route.params.id;
      this.getinfo();
    },
    methods: {
      getinfo() {
        var url = common.apidomain + '/api/getnew/' + this.id;

        this.$http.get(url).then(function(response) {
          var body = response.body;
          if(body.status != 0) {
            Toast(body.message);
            return;
          }

          this.list = body.message[0];

        })
      }
    }
  }
</script>

<style>
  .title h4 {
    color: #26a2ff;
  }
  .title p {
    font-size: 12px;
    line-height: 20px;
    color: rgba(0, 0, 0, .5);
  }
  .title, #content {
    padding-top: 8px;
  }
</style>